{#{% load static %}#}
{% extends 'base/header.html' %}
{% block title %}
    发布论坛教学
{% endblock %}
{% block header %}
    <link rel="stylesheet" href="{% static 'bootstrap/css/bootstrap.css' %}">
    <script src="{% static 'bootstrap/js/bootstrap.js' %}"></script>
    <link rel="stylesheet" href="{% static 'bootstrap/css/base.css' %}">
    <link href="{% static 'bootstrap/css/normalize.min.css' %}" rel="stylesheet">
    {#    <link href="https://cdn.jsdelivr.net/npm/@wangeditor/editor@latest/dist/css/style.css" rel="stylesheet">#}
{#    <script src="https://cdn.tiny.cloud/1/no-api-key/tinymce/7/tinymce.min.js" referrerpolicy="origin"></script>#}
{#    <script src="{% static 'bootstrap/js/tinymce.min.js' %}" referrerpolicy="origin"></script>#}
<script src="https://cdn.tiny.cloud/1/zc0727hwyq3sqtxe8klea5g5ob7w1wkqiiz3zzvb933hbf7s/tinymce/7/tinymce.min.js" referrerpolicy="origin"></script>

    <link rel="stylesheet" href="{% static 'bootstrap/css/style.css' %}">
    <link href="{% static 'bootstrap/css/layout.css' %}" rel="stylesheet">
    <script src="{% static 'bootstrap/js/index.js' %}"></script>
    <script src="{% static 'bootstrap/js/custom-elem.js' %}"></script>
{% endblock %}

{% block body %}
    <h2>发布信息</h2>
    <hr>
        <h1 style="color: green">{{ msg }}</h1>
    <form method="post" enctype="multipart/form-data">
        <div class="mb-3">
            <label for="title" class="form-label">标题</label>
            <input type="text" class="form-control" name="title" id="title" placeholder="请输入标题">
        </div>

        <div class="mb-3">
            <label for="classify" class="form-label">分类</label>
            <select class="form-select" id="classify" name="classify" aria-label="Default select example">
               {% for category in  categories %}
                   <option value="{{ category.id }}">{{ category.name }}</option>
                {% endfor %}
            </select>
        </div>

        <div class="mb-3">
            <label for="cover" class="form-label">封面</label>
            <div>
                <input type="file" class="form-control" id="cover" name="cover">
            </div>
        </div>


        <div>
            <label for="tiny" class="form-label">内容</label>
            <textarea id="tiny" name="content" class="form-control"></textarea>
        </div>

        <div class="mb-3">
            <label for="dateTime" class="form-label">发布时间</label>
            <input type="datetime-local" class="form-control" name="date_time" id="dateTime"
                   placeholder="请输入标题">
        </div>

        <div class="d-flex mb-3">
            <div class="ms-auto">
                <button type="submit" class="btn btn-primary mb-3">提交信息</button>
            </div>
        </div>
    </form>


    <script>
        window.onload = function () {
            tinymce.init({
                selector: 'textarea#tiny'
            });
        }
    </script>
{% endblock %}